//采购特价商品:https://www.luogu.com.cn/problem/P1744

#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

const int N = 110,INF=0x3f3f3f3f;

struct node
{
    int x,y;
}arr[N];

vector<pair<int,double>> edges[N];
int n,m;

double dist[N];
bool st[N];

void dijkstra(int x,int y)
{
    for(int i = 0; i <= n; i++)
    {
        dist[i]=INF;
    }
    dist[x] = 0;
    for(int i = 1; i <= n; i++)
    {
        int t = 0;
        for(int i = 1; i <= n; i++)
        {
            if(dist[t] > dist[i] && st[i]==false)
                t = i;
        }
        st[t] = true;
        for(auto& e : edges[t])
        {
            int u = e.first;
            double w = e.second;
            if(w+dist[t] < dist[u])
            {
                dist[u] = w + dist[t];
            }
        }
    }
   printf("%.2lf",dist[y]);

}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> arr[i].x >> arr[i].y;
    }
    cin >> m;
    for(int i = 1; i <= m; i++)
    {
        int x,y;
        cin >> x >> y;
        double x1 = arr[x].x,y1=arr[x].y,x2=arr[y].x,y2=arr[y].y;
        int d1 = (x2-x1),d2=(y2-y1);
        double d = sqrt(d1*d1+d2*d2);
        edges[x].push_back({y,d});
        edges[y].push_back({x,d});
    }
    int x,y;
    cin >> x >> y;
    dijkstra(x,y);
    return 0;
}